import java.io.FileInputStream;
import java.io.FileOutputStream;

import compiler.TigerCompilerKernel;

import errorMsg.ErrorMsg;


public class Driver {

	/**
	 * @param args
	 */
	public static void main(String[] args) {
		try {
			TigerCompilerKernel kernel = new TigerCompilerKernel("lib/runtime.s");
			
			System.out.println("OCELOT Compiler v 0.70 beta (for TIGER Language)\n");
			System.out.println("Author : Yuen Tien");
			System.out.println("E-mail : tianyuan@sjtu.edu.cn");
			System.out.println("05 ACM Honored Class, Shanghai Jiaotong University\n");

			System.out.println("Compiling ...\n");
			FileInputStream fis = new FileInputStream(args[0]);
			ErrorMsg emsg = new ErrorMsg(args[0]);

			kernel.compile(fis, emsg, args[0]);
			if (!emsg.anyErrors) System.out.println("Successfully compiled " + args[0] + ".");
		}
		catch (Exception e) {
			e.printStackTrace();
		}
	}

}
